/* POJ 1002 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

const char map[25] = {0x32, 0x32, 0x32, 0x33, 0x33, 0x33, 0x34, 0x34, 0x34, 0x35, 0x35, 0x35,
                      0x36, 0x36, 0x36, 0x37, 0x37, 0x37, 0x37, 0x38, 0x38, 0x38, 0x39, 0x39, 0x39};

char *uncode(char *str)
{
    char *p, *q;
    p = q = str;
    while (*q != '\0') {
        if (*q == '-') {
            q++;
            continue;
        }
        if (*q < 'A')
            *p++ = *q++;
        else
            *p++ = map[*q++ - 'A'];
    }
    *p = '\0';

    return str;
}

int intcmp(const void *a, const void *b)
{
    return *(int *)a - *(int *)b;
}

int main(int argc, char const *argv[])
{
    int n;
    scanf("%d", &n);

    // get telephones
    char buf[100];
    int teles[n];
    for (int i = 0; i < n; i++) {
        scanf("%s", buf);
        teles[i] = atoi(uncode(buf));
    }

    // sort telephones
    qsort(teles, n, sizeof(int), intcmp);

    // print results
    int key = teles[0];
    int counter = 1;
    int has_duplicates = 0;
    for (int i = 1; i < n; i++) {
        if (teles[i] == key) {
            counter++;
            continue;
        }
        // print telephones
        if (counter > 1) {
            has_duplicates = 1;
            printf("%03d-%04d %d\n", key / 10000, key % 10000, counter);
        }
        key = teles[i];
        counter = 1;
    }
    // print last one of telephones
    if (counter > 1) {
        has_duplicates = 1;
        printf("%03d-%04d %d\n", key / 10000, key % 10000, counter);
    }

    if (!has_duplicates)
        printf("No duplicates.\n");

    return 0;
}
